<template>
    <div class="container d-flex jc-between px-2 pb-1">
        <div class="d-flex aside-width">
            <div :class="['react-left ml-4 react-l-s pointer', currentRoute.path === '/intelli-sense' ? 'active' : '']" @click="navigateTo('/intelli-sense')">
                <span class="react-before"></span>
                <span class="text">智能感知</span>
            </div>
            <div :class="['react-left ml-3 pointer', currentRoute.path === '/ecological-dispatching' ? 'active' : '']" @click="navigateTo('/ecological-dispatching')">
                <span class="text">生态调度</span>
            </div>
        </div>
        <div class="inverted-trapezoid-wrapper">
            <div :class="['inverted-trapezoid pointer', currentRoute.path === '/index' ? 'active' : '']" @click="navigateTo('/index')">
                <span class="text">首页</span>
            </div>
        </div>
        <div class="d-flex aside-width">
            <div :class="['react-right mr-3 pointer', currentRoute.path === '/prediction-warning' ? 'active' : '']" @click="navigateTo('/prediction-warning')">
                <span class="text">预测预警</span>
            </div>
            <div :class="['react-right mr-4 react-l-s pointer', currentRoute.path === '/dispatch-command' ? 'active' : '']" @click="navigateTo('/dispatch-command')">
                <span class="react-after"></span>
                <span class="text">调度指挥</span>
            </div>
        </div>
    </div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router';

const currentRoute = useRoute();
const router = useRouter();

const navigateTo = (path) => {
    router.push(path);
};
</script>

<style lang="scss" scoped>
@import "@/assets/shape.css";

.pointer{
    cursor: pointer;
}

.text {
    color: #bbb;
    font-size: 14px;
    font-weight: 100;
    white-space: nowrap;
}

.container {
    width: 100%;
    box-sizing: border-box;
    position: relative;
    display: flex;
    justify-content: center;
}

.aside-width {
    width: 40%;
    position: relative;
    display: flex;
    justify-content: center;
}

.react-r-s,
.react-l-s {
    background-color: #0f1325;
}

.react-right {
    &.react-l-s {
        text-align: right;
        width: 500px;
    }

    background-color: #0f1325;
    font-size: 18px;
    width: 300px;
    line-height: 48px;
    text-align: center;
    transform: skewX(-45deg);
    height: 50px;
    position: relative;

    .react-after {
        position: absolute;
        right: -25px;
        top: 0;
        height: 50px;
        width: 50px;
        background-color: #0f1325;
        transform: skewX(45deg);
    }

    .text {
        display: inline-block;
        transform: skewX(45deg);
    }
}

.react-left {
    &.react-l-s {
        width: 500px;
        text-align: left;
    }

    font-size: 18px;
    width: 300px;
    height: 50px;
    line-height: 48px;
    text-align: center;
    transform: skewX(45deg);
    background-color: #0f1325;
    position: relative;

    .react-before {
        position: absolute;
        left: -25px;
        top: 0;
        height: 50px;
        width: 50px;
        background-color: #0f1325;
        transform: skewX(-45deg);
    }

    .text {
        display: inline-block;
        transform: skewX(-45deg);
    }
}

.inverted-trapezoid-wrapper {
    text-align: center;
    width: 30%;
    height: 50px;
    position: relative;
    display: flex;
    justify-content: center;
}

.inverted-trapezoid {
    width: 100%;
    height: 50px;
    background-color: #0f1325;
    clip-path: polygon(15% 100%, 85% 100%, 100% 0%, 0% 0%);
    position: absolute;
    text-align: center;

    .text {
        line-height: 50px;
        text-align: center;
        display: inline-block;
        height: 50px;
        vertical-align: middle;
    }
}

.active,
.active span {
    background-color: #135edf !important;
    color: white;
    font-weight: 800;
}
.active .text{
    background-color:transparent !important;
}
</style>    